﻿public class Startup
{
    public void ConfigureServices(IServiceCollection services)
    {
        // 增加 BootstrapBlazor 组件
        services.AddBootstrapBlazor();

        // 增加本地化服务配置信息
        services.Configure<RequestLocalizationOptions>(options =>
        {
            var supportedCultures = Configuration.GetSupportCultures().Select(kv => new CultureInfo(kv.Value)).ToList();
            options.DefaultRequestCulture = new RequestCulture("zh-CN");
            options.SupportedCultures = supportedCultures;
            options.SupportedUICultures = supportedCultures;
        });
    }

    public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
    {
        // 启用本地化
        app.UseRequestLocalization(app.ApplicationServices.GetService<IOptions<RequestLocalizationOptions>>().Value);
    }
}